#!/bin/bash
if [ $# -lt 1 ]; then
echo "zip-sign.sh <dir>"
exit 
fi

PREFIX=/home/hitmoon/work/android/WORKING_DIRECTORY
name=${1%/*}
here=$(pwd)
out=${name}-signed.zip
pushd "$name"
zip -ry "$here"/"$name".zip .
popd
[ -f "${out}" ] && rm -fv $out
java -jar $PREFIX/out/host/linux-x86/framework/signapk.jar \
$PREFIX/build/target/product/security/testkey.x509.pem \
$PREFIX/build/target/product/security/testkey.pk8 \
"$name".zip "$out"
rm -fv "$name".zip
echo "output: ${out}, Done!"
